<?php
	session_start();
    require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'../model/Service/ArticlepriceService.php';
    require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'../model/Context/BaseContext.php';
    require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'../model/ServiceResult/ServiceResult.php';
    $articlepriceService = new ArticlepriceService();
   
	if(isset($_POST['code']))
	{
		$context = new BaseContext();
		$result = new ServiceResult();
		$code = $_POST['code'];
		$articlepriceDomainArr = $articlepriceService->getPriceByArticleID($context, $result, $code);
	}
?>

<table id="datatable">
	<thead>
		<tr>
			<th></th>
			<th>Buy Price USD</th>
			<th>Buy Price EUR</th>
			<th>Sell Price USD</th>			
			<th>Sell Price EUR</th>
		</tr>
	</thead>
	<tbody>
	<?php 
		foreach ($articlepriceDomainArr as $articlepriceDomain)
		{
	?>
		<tr>
			<th><?php echo $articlepriceDomain->getDateChangePrice(); ?></th>
			<td><?php echo $articlepriceDomain->getBuyPriceUSD(); ?></td>
			<td><?php echo $articlepriceDomain->getBuyPriceEUR(); ?></td>
			<td><?php echo $articlepriceDomain->getSellPriceUSD(); ?></td>		
			<td><?php echo $articlepriceDomain->getSellPriceEUR(); ?></td>
		</tr>
	<?php } ?>
	</tbody>
</table>

	